package de.nak.notendb.action;

import com.opensymphony.xwork2.Action;

/**
 * The Action to show error messages.
 * 
 * @author Christian Baumhof
 * 
 */
public class ShowErrorAction implements Action {

	/**
	 * True, if no data could be found in the database.
	 */
	private boolean noDataFoundException;

	/**
	 * True, if the database can't be accessed.
	 */
	private boolean noDbAccessException;

	@Override
	public String execute() throws Exception {
		noDataFoundException = false;
		noDbAccessException = false;
		return SUCCESS;
	}

	/**
	 * Shows the error message if database access isn't possible.
	 * 
	 * @return SUCCESS.
	 */
	public String noDbAccessException() {
		noDataFoundException = false;
		noDbAccessException = true;
		return SUCCESS;
	}

	/**
	 * Shows the error message if data could not be found
	 * 
	 * @return SUCCESS.
	 */
	public String noDataFoundException() {
		noDataFoundException = true;
		noDbAccessException = false;
		return SUCCESS;
	}

	/**
	 * Returns true if no data could be found in the database.
	 * 
	 * @return true if no data could be found in the database.
	 */
	public boolean isNoDataFoundException() {
		return noDataFoundException;
	}

	/**
	 * Returns true, if the database can't be accessed.
	 * 
	 * @return true, if the database can't be accessed.
	 */
	public boolean isNoDbAccessException() {
		return noDbAccessException;
	}

}
